From a9b1d4a38979278d8ffb6c4c9e2161c7b67fe93d Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Wed, 8 Jan 2020 17:05:44 +0800 Subject: [PATCH] build: Check for sincosf() sincosf() is really a GCC-specific function that may more may not be supported on non-GCC compilers, so we want to check for it, otherwise we use a fallback implementation, not unlike the one in demos/gtk-demo/gtkgears.c. --- gsk/gsktransform.c | 10 +++++++++- meson.build | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gsk/gsktransform.c b/gsk/gsktransform.c index 3f944db9ea..388dad5b45 100644 --- a/gsk/gsktransform.c +++ b/gsk/gsktransform.c @@ -712,7 +712,15 @@ _sincos (float deg, } else { - sincosf (deg * M_PI / 180.0, out_s, out_c); + float angle = deg * M_PI / 180.0; + +#ifdef HAVE_SINCOSF + sincosf (angle, out_s, out_c); +#else + *out_s = sinf (angle); + *out_c = cosf (angle); +#endif + } } diff --git a/meson.build b/meson.build index c07ae0340e..22a211c4fc 100644 --- a/meson.build +++ b/meson.build @@ -198,6 +198,7 @@ check_functions = [ 'log2', 'exp2', 'sincos', + 'sincosf', ] foreach func : check_functions -- 2.30.2